<template>
  <div class="xiangsheng">
    <lunbo :pro="voiceData.focusImages"></lunbo>

    <div class="nav-box">
      <van-grid :column-num="5">
        <van-grid-item
          v-for="(value, i) in voiceData.tomatoes"
          :key="i"
          :icon="value.img"
          :text="value.name"
        />
      </van-grid>
      <div
        class="top-and-content"
        v-for="(item, index) in voiceData.moduleRankDatas"
        :key="index"
      >
        <div class="content-center-nav">
          <div class="content-center-nav-left">
            <p>{{ item.moduleInfo.displayName }}</p>
          </div>
          <div class="content-center-nav-right">
            <p>更多&nbsp;></p>
          </div>
        </div>

        <div class="content">
          <div
            class="van-tab-box"
            v-for="(value, i) in voiceData.moduleRankDatas[index].albumBriefDetailInfos"
            :key="i"
            @click="goToDetail(value.albumInfo.id)"
          >
            <div class="van-tab-box-left">
              <img :src="value.albumInfo.cover" />
            </div>
            <div class="van-tab-box-right">
              <div class="van-tab-box-title-top">
                {{
                  value.albumInfo.title +
                  value.albumInfo.salePoint
                }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import lunbo from "../components/lunbo.vue";
export default {
  name: "xiangsheng",
  data() {
    return {
      voiceData: {
        focusImages: [],
        moduleRankDatas: [],
        tomatoes: [],
      },
    };
  },
  components: {
    lunbo,
  },
  created() {
    this.getXiangSheng();
  },
  methods: {
    getXiangSheng() {
      this.axios({
        methods: "get",
        url: "https://apis.netstart.cn/ximalaya/index/queryIndexCategoryTabContent?moduleKey=xiangsheng",
      })
        .then((result) => {
          // console.log(result);
          this.voiceData = result.data.data.moduleContent;
          // console.log(this.voiceData);
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style lang="less" scoped>
.content-center-nav {
  width: 359px;
  // height: 40px;
  display: flex;
  // margin-top: 5px;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  .content-center-nav-left {
    p {
      font-size: 16px;
      margin: 0;
    }
  }
  .content-center-nav-right {
    p {
      color: #ccc;
    }
  }
}
.content {
  height: 180px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 0 5px;
}
.xiangsheng{
  padding-bottom: 200px;
}
.van-tab-box {
  width: 180px;
  // flex: 1;
  height: 60px;
  margin-top: 5px;

  .van-tab-box-left {
    width: 60px;
    float: left;
    img {
      width: 60px;
      height: 60px;
      // margin-top: 11px;
    }
  }
  .van-tab-box-right {
    width: 120px;
    float: left;
    margin: 0;

    .van-tab-box-title-top {
      font-size: 14px;
      margin: 0;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      display: -webkit-box;
      overflow: hidden;
      text-overflow: ellipsis;
      word-wrap: break-word;
      word-break: normal;
    }
    .van-tab-box-title-bottom {
      margin: 0;
    }
  }
}
</style>